//微信浏览器统一验证
$(document).ready(function(){
    // var s = new wxee();
    // if(!s.is_weixin()){
    //     window.location.href="../../html/error.html";
    // }else{
    //     $("body").addClass("showin");
    // }
});
/**
 * weixinjs的方法整合
 */
(function(){
    function wxee(){

    }
    wxee.prototype = {

        is_weixin : function(){
            return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
        },
        signature : function(data,shareData){
            wx.config({
                debug : false,
                appId : data.appId,
                timestamp : data.timestamp,
                nonceStr : data.noncestr,
                signature : data.signature,
                jsApiList : [
                    'onMenuShareTimeline',
                    'onMenuShareAppMessage',
                    'onMenuShareQQ',
                    'onMenuShareWeibo']
            });
            wx.ready(function(){
                wx.checkJsApi({
                    jsApiList: [
                        'onMenuShareTimeline',
                        'onMenuShareAppMessage',
                        'onMenuShareQQ',
                        'onMenuShareWeibo'],
                    success: function(res) {

                    }
                });
                wx.onMenuShareAppMessage({
                    title: shareData.title,
                    desc: shareData.desc,
                    link: shareData.url,
                    imgUrl: shareData.imgUrl,
                    type: 'link',
                    success: function () {
                        alert("分享成功");
                    },
                    cancel: function () {
                        alert("分享取消");
                    }
                });
            });
            wx.error(function(res){
            });
        }
    }
    window.wxee = wxee;
}())